<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>Simple Contact List Management</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link href="css/styles.css" rel="stylesheet" type="text/css"/>
        <?php $xajax->printJavascript('xajax/'); ?>
        <script type="text/javascript">

// Remove an element
function removeElement(name) {
    var remove;
    if (name.constructor == String)
        remove = el(name);
    else
        remove = name;
        
    if (remove) {
        var parent = remove.parentNode;
        parent.removeChild(remove);
    }
};


// Wrapper for document.getElementById
var el;
if(document.getElementById){
    el = function(id){
        return document.getElementById(id);
    }
}else if(document.all){
    el = function(id){
        return document.all[id];
    }
}else if(document.layers){
    el = function(id, baseLayers){
       baseLayers = baseLayers||document.layers;
       var obj = baseLayers[id];
       if(!obj){ //Element not found
          for(var c = 0;c < baseLayers.length;c++){
             if((baseLayers[c])&&  //Object at index - c.
               (baseLayers[c].document)&& //It has a - document.
               (baseLayers[c].document.layers)){
                obj=el(id,baseLayers[c].document.layers);
                if(obj)break;
             }
          }
       }
       return obj||null;
    }
}else{
    el = function(id){
        return null;
    }
}



///////////////////////////////////////////////////////////////////////////////
// Function: next
// Returns the first element.nextSibling with a nodeType of 1 and optionally matches the tagName 
// _e        element reference
// tag_name  optional. tag name (i.e. DIV)
///////////////////////////////////////////////////////////////////////////////
function next(_e, tag_name) { // next element sibling
    if (tag_name) {
        tag_name = tag_name.toUpperCase();
        do {
            _e = _e.nextSibling;
        } while (_e && (_e.nodeType != 1 || _e.tagName != tag_name));
        return _e;
    }
    else {
        do {
            _e = _e.nextSibling;
        } while (_e && _e.nodeType != 1);
        return _e;
    }
};



///////////////////////////////////////////////////////////////////////////////
// Function: first
// Returns the first child of an element with a nodeType of 1 and optionally matches the tagName 
// _e        element reference
// tag_name  optional. tag name (i.e. DIV)
///////////////////////////////////////////////////////////////////////////////
function first(_e, tag_name) { // first element child
    _e = _e.firstChild;
    if (tag_name) {
        tag_name = tag_name.toUpperCase();
        // we're checking to see if _e exists in the DOM, then if nodeType = 1 and tagName matches tag_name - if so, return it, otherwise, keep searching
        return (_e && (_e.nodeType == 1 && _e.tagName == tag_name) ? _e : next(_e, tag_name));
    }
    
    // check to make sure the _e exists in the DOM, and if it's nodeType = 1 - if so, return it, otherwise, keep searching
    return (_e && _e.nodeType != 1 ? next (_e) : _e);
};




///////////////////////////////////////////////////////////////////////////////
// Function: ts_form_okd(form_element, event)
// Description:
//   Written for use in TSheets.com
//   Designed to be called from a forms' onKeyDown function.
//   Handles a few special keys:
//   * On <enter>  it calls the form's onSubmit() function
//   * On <escape> it calls the form's my_escape() function if you've defined one
//
// Example: <form onKeyDown="return ts_form_okd(this, event);" onSubmit="do something here...">
//////////////////////////////////////////////////////////////////////////////
function ts_form_okd(element, ev) {
    if (!ev) ev = window.event;
    // Turn "element" into _form if it's not already an element
    if (typeof(element) == 'string') var _form = el(element);
    else var _form = element;
    if (!_form) return false;
    
    // Get the element that the person is typing into
    var _target = false;
    if (ev.target)           _target = ev.target;
    else if (ev.srcElement)  _target = ev.srcElement;
    if (_target.nodeType==3) _target = _target.parentNode; // Defeat Safari bug
    
    // Get the key they just pressed
    var code = ev.keyCode;
    if (code) {
        // <ENTER>
        if (code == 13) {
            // Don't submit the form if they hit enter while in a <textarea> tag
            if (_target.tagName == 'TEXTAREA') return true;
            
            // Submit the form
            else {
                _form.onsubmit(ev);
            }
            return false;
        }
        
        // <ESC>
        if (code == 27) {
            if (typeof(_form.my_escape) == 'function') {
                _form.my_escape(ev);
                return false;
            }
        }
    }
    return true;
};




function reset_nav() {
    var nodes = el('navigation').childNodes;
    for (var counter=0; counter < nodes.length; counter++) {
        if (nodes[counter].tagName == 'LI') {
            first(nodes[counter], 'A').style.fontWeight = 'normal';
        }
    }
};


window.onload = function(ev) {
    <?php echo $onload_js; ?>
    return(true);
};

        </script>
    </head>

    <body>
        <div id="content">
            <div class="header clearfix">
                <a href="index.html">
                    <img src="img/title.jpg" class="title" alt="Novel Projects"/>
                </a>
                <img src="img/header.jpg" class="banner" alt="Header"/>
            </div>
            <div class="body clearfix">
                <ul id="navigation" class="left">
                    <li class="current" id="home_link"><a href="default.php">Home</a></li>
                    <li id="my_contacts_link"><a href="#" onclick="xajax_run('renderLogin'); reset_nav(); this.style.fontWeight='bold'; return false;">My Contacts</a></li>
                    <li id="add_contact_link"class="indented"><a href="#" onclick="xajax_run('renderLogin'); reset_nav(); this.style.fontWeight='bold'; return false;">Add New Contact</a></li>
                    <li id="my_lists_link"><a href="#" onclick="xajax_run('renderLogin'); reset_nav(); this.style.fontWeight='bold'; return false;">My Lists</a></li>
                    <li id="add_new_list_link" class="indented"><a href="#" onclick="xajax_run('renderAddContactList'); reset_nav(); this.style.fontWeight='bold'; return false;">Add New List</a></li>
                    <li id="my_account_link"><a href="#" onclick="xajax_run('renderLogin'); reset_nav(); this.style.fontWeight='bold'; return false;">My Account</a></li>
                    <li id="log_in_link"><a href="#" onclick="xajax_run('renderLogin'); reset_nav(); this.style.fontWeight='bold'; return false;">Log In</a></li>
                    <li id="log_out_link"><a href="#" onclick="xajax_run('logout'); reset_nav(); this.style.fontWeight='bold'; return false;">Log Out</a></li>
                    <li id="create_account_link"><a href="#" onclick="xajax_run('renderLogin'); reset_nav(); this.style.fontWeight='bold'; return false;">Create Account</a></li>
                    <li id="contact_us_link"><a href="contact.php">Contact Us</a></li>
                </ul>
                <div id="body" class="right">
                    <h2>What is Simple Contact List Management (SCLM)?</h2>
                    <p>It is cool.</p>
                    <p>It is interesting.</p>
                    <p>It is being built now.  On this server.</p>
                </div>
                <div class="clear"></div>
                <div class="bottom">
                    &copy; Copyright Nebula Shift 2010
                </div>
            </div>
            <div class="footer"></div>
        </div>
    </body>
</html>